package com.tiancheng.trade.payment.enums;

import com.tiancheng.trade.commom.core.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 订单业务渠道来源
 * 有些业务场景是直接调用支付中心，所以编码有可能不存在订单中心
 *
 * @author kellen
 * @date 2024/3/4
 */
@Getter
@AllArgsConstructor
public enum BusinessTypeEnum implements BaseEnum<String> {

    HOTEL("1", "酒店"),
    FLIGHT("2", "机票"),
    TICKET("3", "门票"),
    LINE("4", "精品线路"),
    BUS_TICKET("5", "汽车票"),
    FREE("6", "自由行"),
    TRAFFIC("7", "交通"),
    CHARTERE("8", "包车"),
    CAR_HAILING("9", "网约车"),
    ETC("10", "ETC"),
    OFFICIAL_TRIP("11", "公务出行"),
    GUIDE("12", "达人带你游"),
    UNMANNED_SUPERMARKET("13", "无人超市"),
    TOURISM_INVESTMENT("14", "建水旅投"),
    GUIDE_NEW("15", "新达人带你游"),
    TOURISM_PACKAGES("16", "旅行套餐"),
    ERHAI_TICKET_WAREHOUSE("17", "洱海票仓"),
    NFT("18", "NFT数字藏品"),
    YUN_PIN("20", "云品"),
    CREDIT("88", "诚信"),
    DRIVERLESS("90", "无人车"),
    CONSOLIDATION("99", "合单"),
    ;

    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<BusinessTypeEnum> found = Arrays.stream(BusinessTypeEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }

}
